package com.zhj.util.state.chain;

/**
 * @author zhj
 * @create 2024-04-18-14:38
 */
public class StateMachineTransaction {

    private Enum currentState;

    private Enum event;

    private Enum nextState;

    public StateMachineTransaction() {

    }

    public StateMachineTransaction(StateMachineTransaction origin) {
        this.currentState = origin.currentState;
        this.event = origin.event;
        this.nextState = origin.nextState;
    }

    public Enum getCurrentState() {
        return currentState;
    }

    public void setCurrentState(Enum currentState) {
        this.currentState = currentState;
    }

    public Enum getEvent() {
        return event;
    }

    public void setEvent(Enum action) {
        this.event = action;
    }

    public Enum getNextState() {
        return nextState;
    }

    public void setNextState(Enum nextState) {
        this.nextState = nextState;
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private StateMachineTransaction target;

        public Builder() {
            this.target = new StateMachineTransaction();
        }

        public Builder currentState(Enum currentState) {
            target.currentState = currentState;
            return this;
        }

        public Builder event(Enum event) {
            target.event = event;
            return this;
        }

        public Builder nextState(Enum nextState) {
            target.nextState = nextState;
            return this;
        }

        public StateMachineTransaction build() {
            return new StateMachineTransaction(target);
        }

    }
}
